let fun={
    exit:()=>{
        window.location.href="login";
        window.localStorage.clear();
        window.sessionStorage.clear();
    },
    openMenu:(num)=>{
        for(let i=0;i<7;i++){
            let menu=document.getElementById("menu"+i);
            menu.classList.remove("menu_selected");
            if(i===num){
                menu.classList.add("menu_selected");
                document.getElementById("iframe").src="menu"+num+window.html_end;
            }
        }
        document.getElementById("center_top").style.height=(num===0?"0":"47")+"px";
        document.getElementById("iframe").style.height="calc( 100vh - "+(48+(num===0?0:47))+"px )";
        window.sessionStorage.setItem("menu_num",num);
    },
    updateDateTime:()=>{
        let date=new Date();
        let d=document.getElementById("datetime");
        d.innerText=date.getFullYear()+"年"+(date.getUTCMonth()+1)+"月"+date.getUTCDate()+"日 "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
        setTimeout(fun.updateDateTime,1000);
    }
}
let num=window.sessionStorage.getItem("menu_num");
if(num===undefined || num===null || isNaN(num))fun.openMenu(0);
else fun.openMenu(parseInt(num));
fun.updateDateTime();
document.getElementById("phone").innerHTML="账户："+window.sessionStorage.getItem("phone");